export const requestImage = async (src: string): Promise<HTMLImageElement> => {
  return new Promise((resolve, reject) => {
    let img = new Image();
    img.crossOrigin = "anonymous"; //use-credentials
    img.onload = () => {
      resolve(img); //加载时执行resolve函数
    };
    img.onerror = () => {
      reject(src + "Not Found.");
    };
    img.src = src;
  });
};
